cmake_minimum_required(VERSION 3.24)
project(artillerySystem)

set(CMAKE_CXX_STANDARD 20 REQUIRED)

if(CMAKE_COMPILER_IS_GNUCXX)
    message(STATUS "GCC detected, adding compile flags")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -pedantic -Wall -Wextra")
endif(CMAKE_COMPILER_IS_GNUCXX)

add_executable(
        ${PROJECT_NAME}
        src/main.cpp
        src/user-interface/UserInterface.h
        src/user-interface/UserInterface.cpp
        src/entities/_identifiable/IdentifiableList.h
        src/entities/_identifiable/IdentifiableList.cpp
        src/entities/_identifiable/Identifiable.h
        src/entities/_identifiable/Identifiable.cpp
        src/entities/soldier/Soldier.h
        src/entities/soldier/Soldier.cpp
        src/entities/missile/Missile.h
        src/entities/missile/Missile.h
        src/entities/missile/Missile.cpp
        src/entities/combat-unit/transport-charging-machine/TransportChargingMachine.h
        src/entities/combat-unit/transport-charging-machine/TransportChargingMachine.cpp
        src/entities/combat-unit/CombatUnit.h
        src/entities/combat-unit/CombatUnit.cpp
        src/entities/combat-unit/self-propelled-launcher/SelfPropelledLauncher.h
        src/entities/combat-unit/self-propelled-launcher/SelfPropelledLauncher.cpp
        src/entities/combat-unit/launcher/Launcher.h
        src/entities/maintenance-crew/MaintenanceCrew.h
        src/entities/maintenance-crew/MaintenanceCrew.cpp
        src/entities/battalion/Battalion.cpp
        src/entities/battalion/Battalion.h
        src/exceptions/EntityNotFound.h
        src/entities/combat-unit/launcher/Launcher.cpp
        src/user-interface/keys-enum/KeysEnum.h
        src/user-interface/pages/preview-menu/PreviewMenu.h
        src/user-interface/pages/preview-menu/PreviewMenu.cpp
        src/user-interface/keys-enum/KeysEnum.cpp
        src/user-interface/keys-enum/KeysEnum.cpp
        src/user-interface/pages/soldiers-menu/SoldiersMenu.cpp
        src/user-interface/pages/soldiers-menu/SoldiersMenu.h
        src/user-interface/pages/main-menu/MainMenu.cpp
        src/user-interface/pages/main-menu/MainMenu.h
        src/user-interface/pages/_abstract-menu/Menu.cpp
        src/user-interface/pages/_abstract-menu/Menu.h
        src/user-interface/valid-input/ValidInput.h
        src/user-interface/valid-input/ValidInput.cpp
        src/user-interface/pages/units-menu/UnitsMenu.cpp
        src/user-interface/pages/units-menu/UnitsMenu.h
        src/repositories/battalion-repository/BattalionRepository.cpp
        src/repositories/battalion-repository/BattalionRepository.h
        src/repositories/crew-repository/CrewRepository.cpp
        src/repositories/crew-repository/CrewRepository.h
        src/repositories/missile-repository/MissileRepository.cpp
        src/repositories/missile-repository/MissileRepository.h
        src/repositories/soldier-repository/SoldierRepository.cpp
        src/repositories/soldier-repository/SoldierRepository.h
        src/repositories/unit-repository/UnitRepository.cpp
        src/repositories/unit-repository/UnitRepository.h
        src/services/soldiers-service/SoldiersService.cpp
        src/services/soldiers-service/SoldiersService.h
        src/services/crews-service/CrewsService.cpp
        src/services/crews-service/CrewsService.h
        src/services/MainService.cpp
        src/services/MainService.h
        src/services/combat-units-service/UnitsService.cpp
        src/services/combat-units-service/UnitsService.h
        src/services/battalions-service/BattalionsService.cpp
        src/services/battalions-service/BattalionsService.h
        src/user-interface/pages/battalions-menu/BattalionsMenu.cpp
        src/user-interface/pages/battalions-menu/BattalionsMenu.h
        src/user-interface/pages/crews-menu/CrewsMenu.cpp
        src/user-interface/pages/crews-menu/CrewsMenu.h
        src/user-interface/keydown-handler/KeydownHandler.h
        src/user-interface/keydown-handler/KeydownHandler.cpp
        src/services/missiles-service/MissilesService.cpp
        src/services/missiles-service/MissilesService.h
        src/user-interface/pages/missiles-menu/MissilesMenu.cpp
        src/user-interface/pages/missiles-menu/MissilesMenu.h
        src/user-interface/pages/about-author-menu/AboutAuthorMenu.cpp
        src/user-interface/pages/about-author-menu/AboutAuthorMenu.h
        src/user-interface/pages/about-program-menu/AboutProgramMenu.cpp
        src/user-interface/pages/about-program-menu/AboutProgramMenu.h
        src/user-interface/pages/operator-manual-menu/OperatorManualMenu.cpp
        src/user-interface/pages/operator-manual-menu/OperatorManualMenu.h
)

include(FetchContent)

FetchContent_Declare(nanoid_cpp
        GIT_REPOSITORY https://github.com/mcmikecreations/nanoid_cpp.git
        GIT_TAG HEAD)
FetchContent_MakeAvailable(nanoid_cpp)

FetchContent_Declare(
        cpp-i18n
        GIT_REPOSITORY   https://github.com/Sinan-Karakaya/cpp-i18n.git
        GIT_TAG          v0.2.2
)

FetchContent_MakeAvailable(cpp-i18n)

target_link_libraries(${PROJECT_NAME} PUBLIC
        nanoid
        cpp-i18n
        nlohmann_json::nlohmann_json
)

target_include_directories(
        ${PROJECT_NAME}
        PUBLIC
        ${cpp-i18n_SOURCE_DIR}/include
)

file(COPY src/user-interface/assets DESTINATION ${CMAKE_BINARY_DIR})